package com.tongtong.stscommon.config;

import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * 七牛云配置
 */

@Configuration
@PropertySource(value = "classpath:qiniu.properties")
public class QiniuConfig {

	@Value("${oss.qiniu.accessKey}")
	private String accessKey;

	@Value("${oss.qiniu.secretKey}")
	private String secretKey;

	/**
	 * 认证信息实例
	 */
	@Bean
	public Auth auth() {
		return Auth.create(accessKey,secretKey);
	}

	@Bean
	public UploadManager getUploadManager() {
		return new UploadManager(new com.qiniu.storage.Configuration());
	}
}
